package com.zhongke.cotrun.service.impl;

import com.zhongke.cotrun.common.util.AbstractGuavaCache;
import com.zhongke.cotrun.common.util.GuavaCache;
import com.zhongke.cotrun.mapper.CommonConfigMapper;
import com.zhongke.cotrun.model.pojo.Region;
import com.zhongke.cotrun.service.CommonConfigService;
import com.zhongke.cotrun.model.pojo.CommonConfig;
import javax.annotation.Resource;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.concurrent.TimeUnit;

/**
* 作者 yhl
* 日期 2020-01-05 04:45:15
* 描述 CommonConfig 服务实现
*/
@Service
@Transactional(readOnly = true, rollbackFor = Exception.class)
public class CommonConfigImpl implements CommonConfigService {
    @Resource
    private CommonConfigMapper commonConfigMapper;


    /**
     * 根据主键删除数据
     * @param projectId
     */
    @Override
    public int deleteByPrimaryKey(Integer projectId){
        return commonConfigMapper.deleteByPrimaryKey(projectId);
    }

    /**
     * 插入数据库记录
     * @param record
     */
    @Override
    public int insertSelective(CommonConfig record){
        return commonConfigMapper.insertSelective(record);
    }

    /**
     * 修改数据
     * @param record
     */
    @Override
    public int updateByPrimaryKeySelective(CommonConfig record){
        return commonConfigMapper.updateByPrimaryKeySelective(record);
    }

    /**
     * 根据主键id查询
     * @param projectId
     */
    @Override
    @Cacheable(value = "sysConfig:common",key = "#projectId")
    public CommonConfig selectByPrimaryKey(Integer projectId){

        return commonConfigMapper.selectByPrimaryKey(projectId);
    }

}
